
if exists(select name from sysobjects where name = 'sp_YKienGetById')
	drop proc sp_YKienGetById
go
/*
	Created by: Phuoc NH
	Created on: 13/05/2013 (dd/mm/yyyy)
	Description: 
	--

	File:$sql-scripts/Proc.sp_YKienGetById.sql
*/

create proc sp_YKienGetById
@YKienId varchar(50),
@NguoiDoc int
as
begin
	declare @TrangThai int
	set @TrangThai=(select TrangThai from YKien where YKienId=@YKienId)
	if(@TrangThai=1)
		begin
			update YKien set TrangThai=2 where YKienId=@YKienId
		end
	select * from YKien where YKienId=@YKienId and TrangThai<>255
end

